package de.tabuma.sso.groupprivileg;

import de.tabuma.sso.groupprivileg.GroupPrivileg;
import de.tabuma.sso.privileg.Privileg;
import de.tabuma.sso.group.Group;
import de.tabuma.sso.privileg.PrivilegFacade;
import de.tabuma.sso.logik.*;
import de.tabuma.sso.group.GroupFacade;

import java.util.*;
import java.util.logging.*;

/**
  * @author $Author: alefen $
  * @version $Revision: 1.2 $
  * @since $Date: 2010/01/04 10:29:47 $
 */
public class GroupPrivilegFacade implements de.tabuma.lib.contentmanagement.FacadeInterface {

    private static final Logger log = Logger.getLogger(GroupPrivilegFacade.class.getName());

    public static int create(GroupPrivileg gp, String user) {
        return (int) PMF.doCreate(gp, user);
    }

    public int createElement(Object object, String user) {
        return create((GroupPrivileg) object,user);
    }

    public static GroupPrivileg get(int id) {
        return PMF.get(id, new GroupPrivileg());
    }

    public Object getElement(int id) {
        return get(id);
    }

    public static void update(GroupPrivileg pg, String user) {
        PMF.doUpdate(pg, user);
    }

    public void updateElement(Object object, String user) {
        update((GroupPrivileg) object, user);
    }

    public static void remove(int id, String user) {
        GroupPrivileg gp = get(id);
        PMF.doRemove(gp, user);
    }

    public void removeElement(int id, String user) {
        remove(id,user);
    }

    public static List<GroupPrivileg> getList(int groupId) {
        String keys[] = new String[1];
        keys[0] = "groupId";
        String values[] = new String[1];
        values[0] = "" + groupId;
        return PMF.get(keys, values, new GroupPrivileg());
    }

    public static List<GroupPrivileg> getList1(int privilegId) {
        String keys[] = new String[1];
        keys[0] = "privilegId";
        String values[] = new String[1];
        values[0] = "" + privilegId;
        return PMF.get(keys, values, new GroupPrivileg());
    }

    public List getElementList(String listParameter) {
        return getList(Integer.valueOf(listParameter).intValue());
    }

}
